<?php
class eBayTools extends gravy{
	function __construct(){
		parent::__construct();
	}

	static function getGMT($time=NULL,$format=NULL){
		$result=false;
		
		$time=($time===NULL)?time():$time;
		
		$offset=date("Z");
		
		$result=$time-$offset;
		
		if($format!==NULL){
			$result=date($format,$result);
		}

		return($result);
	}

	static public function Timestamp($time=NULL){
		$result=0;
		if($time==NULL){
			$time=eBayTools::getGMT();
		}elseif(is_numeric($time)){
			$time=eBayTools::getGMT($time);
		}elseif(is_string($time)){
			if(strpos($time,"T")>0){
				$result=str_replace("T"," ",$time);
				$result=preg_replace("/\.\d{,3}Z/","",$result);
				$result=@strtotime($result);
			}
		}
		return($result);
	}
}
?>